package greedy.onClass.class1.exer03;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            int n = sc.nextInt();
            List<int[]> list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                list.add(new int[] {i + 1, sc.nextInt()});
            }
            Collections.sort(list, (e1, e2) -> e1[1] - e2[1]);
            for (int i = 0; i < list.size() - 1; i++) {
                System.out.print(list.get(i)[0] + " ");
            }
            System.out.println(list.get(list.size() - 1)[0]);
            double waitTime = 0d;
            for (int i = 0; i < list.size() - 1; i++) {
                waitTime += (list.size() - 1 - i) * list.get(i)[1];
            }
            System.out.printf("%.2f\n", waitTime / list.size());
        }
        sc.close();
    }
}
